package com.lanou.controller;

import com.lanou.entity.MyConsult;
import com.lanou.service.MyConsultService;
import com.lanou.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName MyConsultController
 * @Description TODO
 * @Author lizhenjiang
 * @Date 2025年08月14日 21:38
 * @Version 1.0
 */
@RestController
@RequestMapping("myConsult")
public class MyConsultController {
    @Autowired
    private MyConsultService myConsultService;

    @PostMapping
    public R addMyConsult(@RequestBody MyConsult myConsult) {
        return R.ok(myConsultService.addMyConsult(myConsult));
    }

    @PutMapping
    public R updateMyConsult(@RequestBody MyConsult myConsult) {
        return R.ok(myConsultService.updateMyConsult(myConsult));
    }
    @DeleteMapping("{id}")
    public R deleteMyConsult(@PathVariable Integer id) {
        return R.ok(myConsultService.deleteMyConsult(id));
    }

    @GetMapping("getPages")
    public R getMyConsultList(@RequestParam(value = "userId") Integer userId,@RequestParam(value = "status") String status, @RequestParam(value = "pageNum",defaultValue = "1",required = false) Integer pageNum, @RequestParam(value = "pageSize",defaultValue = "10",required = false) Integer pageSize) {
        return R.ok(myConsultService.getMyConsult(userId,status,pageNum, pageSize));
    }
}
